In order to communicate to an external api which requires Oauth2 token, I am trying to do an oauth flow but while returning back the authorization code to https://id.atlassian.com/outboundAuth/finish?code= I am getting a CORS error.
In the forge app that i created, below is the manifest.yml:
modules:macro:- key: forge-pronnel-hello-worldfunction: maintitle: Forge Pronneldescription: Tests a login with External Authfunction:- key: mainhandler: index.runproviders:auth:- pronnelauthapp:id: ari:cloud:ecosystem::app/1418a354-da0e-421c-a3f9-17939d41bb11providers:auth:- key: pronnelauthname: Pronnel Authscopes:- pronnel.crm.readtype: oauth2clientId: 65b15e1edd141d727b2113e2remotes:- pronnel-authbearerMethod: authorization-headeractions:authorization:remote: pronnel-accountpath: /oauth/authorizeexchange:remote: pronnel-authpath: /tokenrevokeToken:remote: pronnel-authpath: /revokeretrieveProfile:remote: pronnel-authpath: /userInforesolvers:id: subdisplayName: emailremotes:- key: pronnel-accountbaseUrl: https://dev1.pronnel.com- key: pronnel-authbaseUrl: https://dev1api.pronnel.com/oauthpermissions:external:fetch:backend:- 'https://dev1api.pronnel.com/oauth'- 'https://dev1.pronnel.com'
In the index.tsx frontend file I have used the methods as explained in their documentation.
```const pronnel = api.asUser().withProvider('pronnelauth', 'pronnel-auth')if (!await pronnel.hasCredentials()) {await pronnel.requestCredentials()}```
In the browser below are the calls happening:
**Authorization** - returns HTTP 200
https://dev1api.pronnel.com/oauth/authorize?response_type=code&client_id=65b15e1edd141d727b2113e2&redirect_uri=https:%2F%2Fid.atlassian.com%2FoutboundAuth%2Ffinish&state=pronnel&scope=pronnel.crm.read&org_id=5f0d90d6f1ce534225949ee9
**Decision** - return HTTP 302
https://dev1api.pronnel.com/oauth/dialog/authorize/decision?transaction_id=UavPDsRR&response_type=code&client_id=65b15e1edd141d727b2113e2&redirect_uri=https://id.atlassian.com/outboundAuth/finish&state=pronnel&scope=pronnel.crm.read&org_id=5f0d90d6f1ce534225949ee9
After this the flow is redirected to the Redirect URI i.e.
https://id.atlassian.com/outboundAuth/finish?code=*authorizationCode*
and this gives a CORS error.
Can someone help in understanding what could be the issue here? Is there any configuration that is missing?
It looks like you're new here. Sign in or register to get started.