Angular6 oauth token validation - oauth

I'm integrating identity server with my angular 6 app. I have an issue with angular-oauth2-oidc library which throws me an error about not a valid token, which is valid when I'm checking it by using hasValidAccessToken function then return me true value. Console shows me different status.
https://ibb.co/CVswZ9K
public isValidAccessToken() {
return this.oauthService.hasValidAccessToken();
}

Having a look at that error message, there are three timestamps:
now: 1547200214894 (GMT: Friday, January 11, 2019 9:50:14.894 AM)
issuedAtMSec: 1547201970000 (GMT: Friday, January 11, 2019 10:19:30 AM)
expiresAtMSec: 1547202270000 (GMT: Friday, January 11, 2019 10:24:30 AM)
The token is not valid as it was issued in the future. Either the server you are getting your token from is in the future, or your machine is in the past.

Related

Magento 2.3.4 Different hour in REST API

I send request via REST API
https://www.mysite.pl/rest/V1/orders/89
And have date and time:
"created_at": "2021-09-21 15:59:34",
When I go to Saels->Orders in admin there is different data and time:
"Sep 21, 2021, 5:59:34 PM"
So there is a 2 hours difference. I think this cause a problem with my payment module. In admin timezone is set to CET Warsaw. Why in REST API call there is other time ?
I fixed this issue for me by selecting the "Coordinated Universal time" in admin:
Store -> configuration -> General -> General -> Local Options

RDOSession.LogonExchangeMailbox doesn't try to login

I have a project that I have to migrate from Windows Server 2013 to Server 2016.
This project use Redemption 4.2 to send the mail. But it works on 2013 but not in 2016
My server Exchange is 2010.
My code
Public RDOSession As Redemption.RDOSession
Set RDOSession = CreateObject("Redemption.RDOSession")
Ecrire_Log "Avant RDOSession.LogonExchangeMailbox"
RDOSession.LogonExchangeMailbox colEmetteurTestComplet.Item(1), strServeurSMTP
Ecrire_Log "RDOSession.LogonExchangeMailbox : loggedon " & RDOSession.LoggedOn
EnvoyerMessageExchangeRDO_err:
Ecrire_Log "Fail to connect"
My log:
Avant RDOSession.LogonExchangeMailbox
Fail to connect - Err : Not logged on. Please log on first N° -2147418113 Source: Redemption.RDOSession.
It seems RDOSession can't be initialed correctly.
I found some post in SO about this problem with this but they don't help me.

questions about composed processor and sink

I'm using Spring Could Data Flow 1.7.2.RELEASE and am trying to follow this blog post
to create a "a combination of processor + sink into a single application: “a new sink”."
When I structured my code as the blog's example I had problems and I figured it was because the blog's example used java.util.Function which is akin to a Processor.
I guessed I should use java.util.Consumer because I am trying to change my existing Sink into a Processor-Sink hybrid
My class looks like this:
#EnableBinding(Sink.class)
public class SampleCombinedSink extends Something {
String modifiedPayload;
Logger log;
Consumer<String> consumer = i -> { modifiedPayload="STUFF ADDED BY CONSUMER i=["+i+"]"; };
public void accept(String s){
log.info("SampleCombinedSink.accept() s="+s);
}
#StreamListener(Sink.INPUT)
public void doSink(String payload) {
consumer.accept(payload);
log.info("SampleCombinedSink.doSink() Payload received.");
log.info("SampleCombinedSink.doSink() payload="+ payload);
log.info("SampleCombinedSink.doSink() modifiedPayload="+ modifiedPayload);
}
}
My output looks like this:
SampleCombinedSink.doSink() Payload received.
SampleCombinedSink.doSink() payload=Friday 11 January 2019 19:03:53.330+0000
SampleCombinedSink.doSink() modifiedPayload=STUFF ADDED BY CONSUMER i=[Friday 11 January 2019 19:03:53.330+0000]
SampleCombinedSink.doSink() Payload received.
SampleCombinedSink.doSink() payload=Friday 11 January 2019 19:03:54.332+0000
SampleCombinedSink.doSink() modifiedPayload=STUFF ADDED BY CONSUMER i=[Friday 11 January 2019 19:03:54.332+0000]
SampleCombinedSink.doSink() Payload received.
SampleCombinedSink.doSink() payload=Friday 11 January 2019 19:03:55.333+0000
SampleCombinedSink.doSink() modifiedPayload=STUFF ADDED BY CONSUMER i=[Friday 11 January 2019 19:03:55.333+0000]
SampleCombinedSink.doSink() Payload received.
SampleCombinedSink.doSink() payload=Friday 11 January 2019 19:03:56.313+0000
SampleCombinedSink.doSink() modifiedPayload=STUFF ADDED BY CONSUMER i=[Friday 11 January 2019 19:03:56.313+0000]
My Source emits a timestamp every second.
I'm confused by my Consumer.
Consumer<String> consumer = i -> { modifiedPayload="STUFF ADDED BY CONSUMER i=["+i+"]"; };
I thought I'd be able to do something like:
Consumer<String> consumer = i -> { i="STUFF ADDED BY CONSUMER i=["+i+"]"; };
and then payload in
#StreamListener(Sink.INPUT)
public void doSink(String payload) {
would contain "STUFF ADDED BY CONSUMER i=[timestamp]"
It didn't.
I want to change the input to doSink and change it by adding "STUFF ADDED BY CONSUMER" so that when the input reaches doSink(String payload) payload will contain "STUFF ADDED BY CONSUMER i=[timestamp]"
How do I achieve that?
In this case, you don't have to change anything with your Sink application instead, just use the same function plumbing at the Sink application side.
For instance, to make:
a combination of processor + sink into a single application: “a new sink”."
all you need is to have your function beans as part of the Sink application or even having the function beans in a separate artifact but in the classpath of Sink application. Once you have this, you can define the spring.cloud.stream.function.definition for the Sink application.
You can see a sample for this here. The app log-composed has the function beans defined.
To run the sample:
dataflow:>app register --name http-transformer --type source --uri file:///Users/igopinathan/dev/git/ilayaperumalg/sandbox/function-composition/http-transformer/target/http-transformer-2.1.0.BUILD-SNAPSHOT.jar
Successfully registered application 'source:http-transformer'
dataflow:>app register --name log-composed --type sink --uri file:///Users/igopinathan/.m2/repository/org/springframework/cloud/stream/app/log-composed/2.1.0.BUILD-SNAPSHOT/log-composed-2.1.0.BUILD-SNAPSHOT.jar
Successfully registered application 'sink:log-composed'
dataflow:>stream create helloComposed --definition "http-transformer --server.port=9001 | log-composed"
Created new stream 'helloComposed'
dataflow:>stream deploy helloComposed --properties "app.log-composed.spring.cloud.stream.function.definition=upper|concat,deployer.*.local.inheritLogging=true"
Deployment request has been sent for stream 'helloComposed'
dataflow:>http post --data "friend" --target "http://localhost:9001"
In the stream deploy command, you can see the app being used to specify the function composition is log-composed.

Date off by 1 day IOS safari - AngularJS

I have a reservation application with a c# mvc api mssqlserver backend and angular frontend, everything is fine in Chrome on browser
however when I go to Safari IOS the dates are off by a single day
for example - on browser: 28th reservation( fromdate:28th todate: 28th)
startdate: 2018-06-28 00:00:00.0000000
end date: 2018-06-28 00:00:00.0000000
- on IOS safari: 28th reservation(fromdate: 27th todate: 27th)
example: 2
on browser: june28th-july19th
on IOS safari: june 27th - july 18th
the dates are retrieved from the db table and I can ensure that their format is
(2018-06-28 00:00:00.0000000)
Additionally, I noticed that when I get that exact datetime on ios it's different than browser- for example, I checked into my reservation at 11:08am and on IOS it showed the same date/time as 7:08am this could possibly be a factor but I don't know how to approach this issue

microsoft graph createreply wrong timezone

In our Angular 5 application, we are using Microsoft Graph to retrieve mail messages from a mailbox and then send a reply. For creating the reply, we use the REST API:
https://graph.microsoft.com/v1.0/me/messages/{message ID}/createReply
This creates a reply with a timezone that is UTC, but we expect it to be GMT+1. For example, in the mail body it says:
From: Melissa van Dijk
Sent: Friday, February 23, 2018 9:51:49 AM (wrong timestamp)
To: Melissa van Dijk
Subject: Meet for lunch?
We checked the settings in our Office 365 mail account and there it is specified that our local timezone is GMT+1 (Brussels, Amsterdam...).
(When replying via Outlook webmail, we get a correct timestamp).
Is this a bug or do we have to correct this timestamp ourselves? Or do we need to pass the timezone with the REST call somehow?
Thanks in advance!
I'm not sure if you can adjust the human-formatted timestamps in the HTML message body, but you can certainly use the ISO 8601 formatted timestamps in the other fields in the JSON of the response. For example, you'll find:
{
...
"sentDateTime": "2018-02-23T09:51:49Z",
...
}
While this is also in UTC (denoted by the Z), you can easily parse it by using a JavaScript Date object, or Angular's own datetime functions, or your favorite time library such as Luxon, Moment, or Date-fns. From there, displaying it in local time is trivial.

Resources