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-world
function: main
title: Forge Pronnel
description: Tests a login with External Auth
function:
- key: main
handler: index.run
providers:
auth:
- pronnelauth
app:
id: ari:cloud:ecosystem::app/1418a354-da0e-421c-a3f9-17939d41bb11
providers:
auth:
- key: pronnelauth
name: Pronnel Auth
scopes:
- pronnel.crm.read
type: oauth2
clientId: 65b15e1edd141d727b2113e2
remotes:
- pronnel-auth
bearerMethod: authorization-header
actions:
authorization:
remote: pronnel-account
path: /oauth/authorize
exchange:
remote: pronnel-auth
path: /token
revokeToken:
remote: pronnel-auth
path: /revoke
retrieveProfile:
remote: pronnel-auth
path: /userInfo
resolvers:
id: sub
displayName: email
remotes:
- key: pronnel-account
baseUrl: https://dev1.pronnel.com
- key: pronnel-auth
baseUrl: https://dev1api.pronnel.com/oauth
permissions:
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
**Decision** - return HTTP 302
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?