I was following this tutorials to use Mautic Rest API
https://tutorialsjoint.com/mautic-rest-api/
But I was stuck in the passing access token to use the api step!
I've done all the previous steps and sucessfully got the access token
(image)
Related
I am trying to get ID token and Refresh token along with access token from Azure AD app via Postman by using below parameters:
GET
https://login.microsoftonline.com/mytenant_id/oauth2/v2.0/token
client_id='myclient_id'
&client_secret='myclient_secret'
&grant_type=authorization_code
&scope=https://graph.microsoft.com/.default
&redirect_uri=https://jwt.ms
I am able to get the access token, but not sure why I am not getting ID token and Refresh token along with it.
Atfirst, I tried with client_credentials flow, but I came to know I have to use auth code flow or OpenID Connect in order to get those tokens.
So I shifted to auth code flow. But still I'm getting access token only:(
I have also enabled the below options in the Portal
What else settings are needed to get the tokens? Any suggestions would be appreciated.
Edited:
I have given below API permissions:
Please note that, getting ID token and Refresh token along with access token depends on the scope/API permissions you grant to the application as mentioned in this MsDoc.
I tried to reproduce the same in my environment and added scopes like below:
After adding the openid and offline_access in the scope, I got all tokens successfully like below:
I am trying to fetch the list of resources present in my Azure Resource Group.
To do that, I got an access token by registering one app in Azure AD using the client_credentials flow.
But when I am using that token to query like below, I'm getting 401 Unauthorized - Authentication failed error.
Query that I used:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources?api-version=2021-04-01
I have owner access to all my resources but why am I getting 401 Unauthorized error. Is there any step that I missed?
Can anyone point me in a right path?
I came to know I have to give API permissions for Azure Service Management.
After giving user_impersonation, I changed the scope to https://management.azure.com/.default and got access token.
Using this token, I successfully got the list of resources without any errors.
I follow link
I created API for CheckPhoneNumber 'POST' and 'GET' type request as given documentation.
How to test that API?
I searched many sites they are using 'API Console' tab in store. There is required Access Token. I am creating Access 'Production Keys' from DefaultApplication. that Access token am using it is giving error
<ams:fault xmlns:ams="http://wso2.org/apimanager/security">
<ams:code>900908</ams:code>
<ams:message>Resource forbidden </ams:message>
<ams:description>Access failure for API: /phoneverify/1.0.0, version: 1.0.0 status: (900908) - Resource forbidden </ams:description>
</ams:fault>
If there is another way to create Access Token?
Or tell me if am doing something wrong for testing API.
You need to subscribe the Application to the API.
Ref: https://docs.wso2.com/display/AM260/Subscribe+to+an+API
As #Bee pointed out above, you don't have issues with access token, the problem is you have not subscribed to your api in the api manager. error code 900908 implies the API is not subscribed to by the app trying to invoke it.
I am trying to build an app in codename one with the cloud natural language api but I am struggling to figure out how to first get authentication from oauth2 and then make a request to the api.
I have read the quickstart for the cloud natural language api and followed all of the steps. I can make requests to the api from the gcloud command line but I want to be able to make requests from codename one. I want to use oauth2 to get authentication and have an oauth2 client ID but I do not know how to get the authentication token. I have read about it here https://www.codenameone.com/google-login.html but I do not know what to put HERE on line 5 of the following code. Once I have the oauth2 authentication token, I do not know how I will make a request to the api from codename one. I have read about requests to the natural language api here https://cloud.google.com/natural-language/docs/reference/libraries but it did not say how to make a request from codename one.
Login gc = GoogleConnect.getInstance();
gc.setClientId(clientId);
gc.setRedirectURI(redirectURI);
gc.setClientSecret(clientSecret);
gc.setCallback(**HERE**);
if(!gc.isUserLoggedIn()){
gc.doLogin();
}else{
//get the token and now you can query the gplus API
String token = gc.getAccessToken().getToken();
}
In summary, I do not know how to get an oauth2 token from codename one and then make a request to the cloud natural language api with that token.
You should use a slightly newer version of this article here under the "Google Sign-In" section. The token is returned in this line of code String token = gc.getAccessToken().getToken(); but it will only work within the callback code when login was successful.
You will need to use the REST API to make the requests to the server as covered here: https://cloud.google.com/natural-language/docs/reference/rest/
That way it will work for all supported platforms.
I would like to send an email on behalf of a user using Postman (Office 365). I have the email id and password of that account. After doing some research, I have found that I need to login, using a browser, to get the authorization code and then I can perform the next steps from Postman (getting the access token and using the Microsoft Graph Explorer) to send the email.
I would like to get the authorization code using Postman (not browser). I tried and got the following error (which is what should come the way I have requested the API)-
In short, I want to send email from Graph API using a REST client like Postman (right from authorization to sending email). Is this possible?
(I have already read these documents but did not help me get there-
https://developer.microsoft.com/en-us/graph/docs/concepts/rest
Accessing Microsoft Graph API without using login page
Automatically Log-In To Office 365
)
Yes, it is very possible, in fact, you can use all of the Microsoft Graph API from Postman or any other program which can make HTTP requests.
All you need to do is to get access token to use in your requests to the Graph API, and there at least 4 ways which allow you to do so without user interaction. But the process requires some preparation since you need to create an OAuth App in order to be able to use the Graph API.
Since I had to do the same myself and it wasn't easy to collect all the bits of information necessary, I've written a full guide on this subject including Postman examples:
Getting Access Token for Microsoft Graph Using OAuth REST API
In large you need to do the following steps:
Register OAuth App
Configuring App Permission
Use one of the following flows, depending on the information you have:
Flow 1: Get Access Token from Client Credentials (Client credentials Grant)
Flow 2 – Get Access Token From Client & User Credentials (Resource Owner Credentials Grant)
Flow 3 – Get Access Token From Refresh Token (Refresh Token Grant)
Flow 4 – Get Access Token From Another Access Token (On-Behalf-Of Grant)
Use the access token in requests to Microsoft Graph API
All of those steps are explained in the article.