Jump to content
Welcome to our new Citrix community!
  • 0

Trying to Authenticate but I get a cors error


Oscar Asmat

Question

I'm trying to authenticate with your api. When I try via postman everything is fine and I get an access token, but when I do it via my web app there is a cors failure.

 

image.thumb.png.94b268680b3d9a445f9b6ac0c81c27d7.png

 

I added the TrustedDomains with the patch method as per your documentation.

 

image.thumb.png.d416f8498b88609312959d80578bd45b.png

 

Afterwards I made a Get request to confirm the domains are there. 

 

image.thumb.png.8c0951a9e811a73ab1c606318c62fed0.png

 

I'm still getting the error.

 

I tried from all trustedDomains and they all fail.

 

here is my code 

 

export function authenticate(em, ps, sd, sf) {
    let data = {
        grant_type: sf.gt,
        client_id: sf.cid,
        client_secret: sf.css,
        username: em,
        password: ps
    };

    return fetch('https://' + sd + '.sharefile.com/oauth/token', {
        method: 'POST',
        cache: 'no-cache',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        body: JSON.stringify(data)
    })
    .then(res => res.json())
    .catch((res) => {
        console.log(res)
        res.json()
    });
}

Please help!

 

Thank you,

Oscar

 

Link to comment

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...